package org.dromara.system.enums;


import org.springframework.util.StringUtils;

/**
 * Created by fly on 2014/12/11.
 */
public enum SysI18nType {
    /**
     *
     */
    common("common", "通用"),
    model("model", "模型"),
    dict("dict", "字典"),
    menu("menu", "菜单"),
    view("view", "页面"),
    msg("msg", "消息"),
    ;

    SysI18nType(String code, String desc) {
        this.code = code;
        this.desc = desc;

    }


    String code;
    String desc;


    public static Boolean check(String code, String sys) {
        for (SysI18nType appCode : SysI18nType.values()) {
            if (appCode.getCode().toLowerCase().equals(code)) {
                return true;
            }
        }
        return false;
    }

    public static SysI18nType valueOfCode(String code) {

        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (SysI18nType status : SysI18nType.values()) {
            if (status.getCode().toLowerCase().equals(code.toLowerCase())) {
                return status;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    @Override
    public String toString() {
        return code + ":" + desc;
    }

}
